﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Wilson/MP/Base.Master" AutoEventWireup="true" CodeBehind="Setting.aspx.cs" Inherits="WebsiteAdmin.Wilson.Setting.Setting" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head_Title" runat="server">网站配置 - 设置</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Head_Meta" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Head_Css" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Head_Script" runat="server">
    <script src="../Script/Mootools.Smoothbox.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
    var MenuViewID = 1;
		
    window.addEvent('domready', function() {
        $('submitbtn').addEvent('click', function() {
            Submit();
        });
    });

    Array.implement({
        getFirstRadio: function() {
            if (this.length == 0) {
                return null;
            }
            return this[0];
        }
    });
    
	function Submit() {
        var txbSiteName = $('SiteName').get('value').trim();
        if (txbSiteName.length == 0) {
            alert('网站标题错误');
            return false;
        }
        var txbSiteKeywords = $('SiteKeywords').get('value').trim();
        var txbSiteDescription = $('SiteDescription').get('value').trim();
        var txbSiteICP = $('SiteICP').get('value').trim();
        var txbHotLine = $('HotLine').get('value').trim();
        var txbEmail = $('Email').get('value').trim();
        var txbIsOpen = $$('input[name=txbIsOpen]:checked').getFirstRadio().get('value').trim();
        
        Update(
        txbSiteName,
        txbSiteKeywords,
        txbSiteDescription,
        txbSiteICP,
        txbHotLine,
        txbEmail,
        txbIsOpen);
    }

    function Update(txbSiteName,
        txbSiteKeywords,
        txbSiteDescription,
        txbSiteICP,
        txbHotLine,
        txbEmail,
        txbIsOpen) {

        new Request.JSON({
            method: 'post',
            url: 'Handler/ConfUpdate.ashx',
            data: {
                SiteName: txbSiteName,
                SiteKeywords: txbSiteKeywords,
                SiteDescription: txbSiteDescription,
                SiteICP: txbSiteICP,
                HotLine: txbHotLine,
                Email: txbEmail,
                IsOpen: txbIsOpen
            },
            noCache: true,
            onSuccess: function(data, text) {
                if (data.Done == 'Success') {
                    alert('修改成功');
                    document.location.href = '/Wilson/Setting/Setting.aspx';
                    //LightBox.remove();
                }
                else {
                    alert('修改失败');
                    //LightBox.remove();
                }
            },
            onFailure: function(xhr) {
                alert(xhr.statusText);
                //LightBox.remove();
            }
        }).send();
    }
		
		
</script>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Body_Top" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Body_Content" runat="server">
    <div class="infobox">
	<h3>
		<span>网站配置</span>
	</h3>
	<form id="myForm" action="">
	    <table border="0" cellpadding="0" cellspacing="0" class="table_form">
	        <tr>
        		<td align="right" width="100"><span class="Need">网站名称：</span></td>
        		<td>
        			<input  type="text" maxlength="50" size="50" id="SiteName" name="SiteName" value="<%=SiteName %>" />
        		</td>
			</tr>
			<tr>
        		<td align="right" width="100"><span class="Need">首页关键词：</span></td>
        		<td>
        			<input  type="text" maxlength="50" size="50" id="SiteKeywords" name="SiteKeywords"  value="<%=SiteKeywords %>" />
        		</td>
			</tr>
			<tr>
        		<td align="right" width="100"><span class="Need">网站介绍：</span></td>
        		<td>
        			<textarea name="SiteDescription" rows="3" cols="20" id="SiteDescription"><%=SiteDescription%></textarea>
        		</td>
			</tr>
			<tr>
			    <td align="right" width="100">ICP备案：</td>
			    <td><input  type="text" maxlength="50" size="50" id="SiteICP" name="SiteICP" value="<%=ICP %>" /></td>
			</tr>
			<tr>
			    <td align="right" width="100">联系电话：</td>
			    <td><input  type="text" maxlength="50" size="50" id="HotLine" name="HotLine" value="<%=HotLine %>" /></td>
			</tr>
			<tr>
			    <td align="right" width="100">电子邮箱：</td>
			    <td><input  type="text" maxlength="50" size="50" id="Email" name="Email" value="<%=Email %>" /></td>
			</tr>
			<tr>
			    <td align="right" width="100">开放访问：</td>
			    <td>
			        <input type="radio" name="txbIsOpen" id="txbIsOpenT" value="1" <% if(IsOpen == 1){ Response.Write("checked='checked'");}%> />
					<label for="txbIsOpenT">开放</label>
					&nbsp;&nbsp;&nbsp;
					<input type="radio" name="txbIsOpen" id="txbIsOpenF" value="0" <% if(IsOpen == 0){ Response.Write("checked='checked'");}%> />
					<label for="txbIsOpenF">关闭</label>
			    </td>
			</tr>
			<!--<tr>
			    <td align="right" width="100">用户注册：</td>
			    <td><input  type="text" maxlength="50" size="50" id="Text2" name="Email" value="<%=Email %>" /></td>
			</tr>-->
		
			
	    </table>
	    <table border="0" cellpadding="0" cellspacing="0" class="table_form">
			<tr>
				<td width="100" height="40">&nbsp;</td>
				<td>
					<input id="submitbtn" type="button" value="提交" class="btn" />
					<input type="reset" value="重置" class="btn" />
				</td>
			</tr>
		</table>
	
	
	</form>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="Body_Foot" runat="server">
</asp:Content>
